<?php

/**
 * login actions.
 *
 * @package    billingSystem
 * @subpackage login
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class loginActions extends sfActions {

    public function executeIndex(sfWebRequest $request) {
        $this->form = new LoginForm();
    }

    protected function processForm(sfWebRequest $request, sfForm $form) {
        $form->bind($request->getPostParameter($form->getName()), $request->getFiles($form->getName()));
        if ($form->isValid()) {
            $login = Doctrine_Core::getTable('Login')->find($request->getPostParameter('login[username]'));
         
 
            if ($login != NULL && ($request->getPostParameter('login[password]')==$login->getPassword())) {
                $this->getUser()->setAttribute('partnerid', $login->getPid());
                $this->redirect('partner');

            }
        }
    }

    public function executeCheck(sfWebRequest $request) {
        $this->form = new LoginForm();
     
   
        $this->processForm($request, $this->form);
    }

}
